package cn.edu.swu.dlx;

public class Student {
    private String name;
    private int age;
    private String major;

    public Student() {}
    public Student(String name, int age, String major) {
        this.name = name;
        this.age = age;
        this.major = major;
    }
    public void setName(String name) {
        this.name = name;
    }
    public void setAge(int age) {
        if (age < 0 || age > 120) {
            System.out.println("年龄输入错误");
            return;
        }
        this.age = age;
    }
    public void setMajor(String major) {
        this.major = major;
    }
    public String getName() {
        return name;
    }
    public int getAge() {
        return age;
    }
    public String getMajor() {
        return major;
    }
}
